﻿using System;

using System;

using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using DiffuseEnjoyIdle.Core.Enums;

namespace System.Linq
{
    /// <summary>
    /// inc模糊查询 数组中的每个值相等
    /// </summary>
    public sealed class ExpBuilderInc : ExpressionBuilderInclude, IExpressionBuilder
    {
        public ExpBuilderInc()
        {
            base.OpType = Enum_ConditionType.Inc;
            base.EndKey = Enum_ConditionType.Inc.ToString();
        }

        protected override Expression GenExp(Expression left, Expression right)
        {
            MethodInfo methodInfo = GetMethodInfo(right.Type.GetElementType());
            ConstantExpression right2 = Expression.Constant(false);
            return Expression.NotEqual(Expression.Call(null, methodInfo, right, left), right2);
        }
    }
}